<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <button @click="list.push('赵六')">添加元素</button>
        <button @click="list.pop()">删除元素</button>
        <ul>
            <!-- <li v-for="item in list">{{ item }}</li> -->

            <!-- 完整写法；既拿到每一项，又拿到下标 -->
            <!-- item就是每一项，index就是下标 -->
            <!-- <li v-for="(item, index) in list">{{ item }} ---- {{ index }} </li> -->

            <!-- 每一项和下标的名字可以随便写 -->
            <li v-for="(v, i) in list">
                {{ v }} ---- {{ i }} 
                <div>{{ v }}</div>
            </li>
            
        </ul>
    </div>
    <script src="./vue.js"></script>
    <script>
        new Vue({
            el: '#app',
            data() {
                return {
                    list: ['张三', '李四', '王五']
                }
            },
        })
    </script>
</body>
</html>